package cc.vant.wechat.fragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;
import java.util.List;

import cc.vant.wechat.R;
import cc.vant.wechat.adapter.ChatAdapter;
import cc.vant.wechat.model.Chat;


public class WechatFragment extends Fragment {
    private List<Chat> chatList = new ArrayList<>();

    public WechatFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        View view = inflater.inflate(R.layout.fragment_wechat, container, false);

        RecyclerView recyclerView = view.findViewById(R.id.chat_recyclerview);
        recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
        chatList.add(new Chat(R.mipmap.rectangle_portrait, "聊天"));
        chatList.add(new Chat(R.mipmap.rectangle_portrait, "聊天"));
        chatList.add(new Chat(R.mipmap.rectangle_portrait, "聊天"));

        ChatAdapter adapter = new ChatAdapter(chatList);
        recyclerView.setAdapter(adapter);
        return view;
    }
}